import { IParam } from '@/core';
import type { PropType } from 'vue';
declare type listMode = 'default' | 'picker' | 'exp';

//  列表输入参数
const mDCtrlProps = {
	//  列表数据
	items: {
		type: Array as PropType<IParam[]>,
		default: () => [],
	},
	//  列表数据
	name: {
		type: String,
		default: '',
	},
	//  空数据提示
	emptyText: {
		type: String,
		default: '',
	},
	selections: {
		type: Array as PropType<IParam[]>,
		default: () => [],
	},
	leftActions: {
		type: Object,
		default: () => {},
	},
	rightActions: {
		type: Object,
		default: () => {},
	},
	loadMore: {
		type: Boolean,
		default: true,
	},
	totalRecord: {
		type: Number,
		default: 0,
	},
	errorStatus: {
		type: Boolean,
		default: false,
	},
	listMode: {
		type: String as PropType<listMode>,
		default: 'default',
	},
	singleSelect: {
		type: Boolean,
		default: true,
	},
	offset: {
		type: Number,
		default: 20,
	},
};

export interface IListItem extends IParam {
	/**
	 * 主键
	 *
	 * @type {string}
	 * @memberof IListItem
	 */
	srfkey: string;

	/**
	 * 主信息
	 *
	 * @type {string}
	 * @memberof IListItem
	 */
	srfmajortext: string;

	/**
	 * 描述
	 *
	 * @type {string}
	 * @memberof IListItem
	 */
	srfdescription: string;

	/**
	 * 图标
	 *
	 * @type {string}
	 * @memberof IListItem
	 */
	srficon: string;

	/**
	 * 是否是分组项
	 *
	 * @type {boolean}
	 * @memberof IListItem
	 */
	isGroupItem?: boolean;

	/**
	 * 是否展开
	 *
	 * @type {boolean}
	 * @memberof IListItem
	 */
	isExpand?: boolean;

	/**
	 * 子项
	 *
	 * @type {IListItem[]}
	 * @memberof IListItem
	 */
	children: IListItem[];
}

const mDCtrlItemProps = {
	item: {
		type: Object as PropType<IListItem>,
		default: () => {},
	},
	leftActions: {
		type: Object,
		default: () => {},
	},
	rightActions: {
		type: Object,
		default: () => {},
	},
	listMode: {
		type: String as PropType<listMode>,
		default: 'default',
	},
	isSelect: {
		type: Boolean,
		default: false,
	},
	singleSelect: {
		type: Boolean,
		default: true,
	},
};

export const MDCtrlProps = mDCtrlProps;
export const MDCtrlItemProps = mDCtrlItemProps;
